﻿package net.wangit.dev.table;

import net.wangit.LabelUtil;
import net.wangit.context.ActionContext;
import net.wangit.context.ActionResult;
import net.wangit.dev.DomainAction;
import net.wangit.jdbc.DB;

public class CreateLogTableAction extends DomainAction {

	public CreateLogTableAction() {
	}

	public void doAction(DB db, ActionContext ac) throws Exception {
		String tableName = ac.getRequestParameter("table.t");
		String logTableName = ac.getRequestParameter("table.lt");
		ActionResult result = ac.getActionResult();
		try {
			ac.setSessionAttribute("dev.table.lt", logTableName);
			result.addInfo(LabelUtil.get(ac, "dev", "table.create.1"));
		} catch (Exception e) {
			result.setSuccessful(false);
			result.addError(LabelUtil.get(ac, "dev", "table.create.0",
					tableName));
			throw e;
		}
	}
}
